package  
{
	import flash.events.MouseEvent;
	import flash.text.TextField;
	/**
	 * ...
	 * @author patsup
	 */
	public class RollButton extends Button 
	{
		//roll button image parameters
		private const RB_COLOR:int = 0x0000FF;
		private const RB_ALPHA:Number = 0.3;
		private const RB_WIDTH:int = 120;
		private const RB_HEIGHT:int = 40;
		
		private var btnLabel:TextField;			//label "Roll"
		
		private var mainRef:Main;
		
		public function RollButton(mainRef:Main, xCoord:int, yCoord:int) 
		{
			name = "Roll Button";
			this.mainRef = mainRef;
			
			btnLabel = new TextField();
			
			Initialize();
			super(xCoord, yCoord);
		}
		//Initialize()
		//Initializes the creation of the RollButton
		public override function Initialize():void
		{
			InitImage();
			InitInput();
			
			super.Initialize();
		}
		
		//InitImage()
		//Initializes the image of the RollButton
		protected override function InitImage():void
		{
			graphics.beginFill(RB_COLOR, RB_ALPHA);
			graphics.drawRect(0, 0, RB_WIDTH, RB_HEIGHT);
			graphics.endFill();
			
			btnLabel.text = "Roll";
			btnLabel.width = btnLabel.textWidth*1.2;			//reduce the textfield's dimensions so they don't inflate the stage
			btnLabel.height = btnLabel.textHeight*1.5;
			btnLabel.x = 0.5 * RB_WIDTH - 0.5 * btnLabel.width;
			btnLabel.y = 0.5 * RB_HEIGHT - 0.5 * btnLabel.height;
			addChild(btnLabel);								//now add this txt label to the display list
			
			super.InitImage();
		}
		
		//InputMouseClick()
		//Takes action for RollButton upon hearing the mouseclick event
		protected override function InputMouseClick(e:MouseEvent):void
		{
			mainRef.EnableDice();
			DisableButton();
			super.InputMouseClick(e);
		}
	}

}